import 'package:flutter/material.dart';
import 'package:lib_common/components/widget/ntt_gesture_widget.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../widget/ntt_ordinary_button.dart';

/// 标准牛听听主题样式弹窗
class NttStandardDialog extends StatelessWidget {
  /// 标题
  final String? title;

  /// 内容
  final String? content;

  /// 富文本内容
  final TextSpan? contentSpan;

  /// 左侧按钮文本
  final String? leftBtnTxt;

  /// 右侧按钮文本
  final String? rightBtnTxt;

  const NttStandardDialog({
    super.key,
    this.title,
    this.content,
    this.contentSpan,
    this.leftBtnTxt,
    this.rightBtnTxt,
  });

  @override
  Widget build(BuildContext context) {
    return PopScope(
      onPopInvoked: (didPop) {
        if (!didPop) {
          Navigator.of(context).pop(false);
        }
      },
      canPop: false,
      child: Scaffold(
        backgroundColor: Colors.transparent,
        body: Center(
          child: Container(
            width: 640.w,
            constraints: BoxConstraints(maxHeight: 0.7.sh),
            height: 416.h,
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(56.h),
            ),
            padding: EdgeInsets.only(
                top: 30.h, bottom: 32.h, left: 32.w, right: 32.w),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                Text(
                  title ?? "标题",
                  style:
                      TextStyle(fontSize: 44.h, color: const Color(0xff40423E)),
                ),
                SizedBox(
                  height: 24.h,
                ),
                Expanded(
                  child: Center(
                    child: contentSpan != null
                        ? Text.rich(
                            contentSpan ??
                                TextSpan(
                                    text: "内容",
                                    style: TextStyle(
                                        fontSize: 36.h,
                                        color: const Color(0xff34443A)
                                            .withOpacity(0.6))),
                          )
                        : Text(
                            content ?? "内容",
                            style: TextStyle(
                                fontSize: 36.h,
                                color:
                                    const Color(0xff34443A).withOpacity(0.6)),
                          ),
                  ),
                ),
                SizedBox(
                  height: 24.h,
                ),
                Row(
                  children: [
                    Expanded(
                      child: NttOrdinaryButton(
                        leftBtnTxt ?? "取消",
                        width: 280.w,
                        height: 96.h,
                        textSize: 36.r,
                        textColor: const Color(0xff34443A).withOpacity(0.6),
                        isShowBorder: false,
                        radius: 16.w,
                        backgroundColor: const Color(0xffF4F6FA),
                        onTap: () {
                          Navigator.of(context).pop(false);
                        },
                      ),
                    ),
                    SizedBox(
                      width: 16.w,
                    ),
                    Expanded(
                      child: NttOrdinaryButton(
                        rightBtnTxt ?? "确定",
                        width: 280.w,
                        height: 96.h,
                        textSize: 36.r,
                        textColor: Colors.white,
                        isShowBorder: false,
                        radius: 16.w,
                        backgroundColor: const Color(0xffFF9B25),
                        onTap: () {
                          Navigator.of(context).pop(true);
                        },
                      ),
                    ),
                  ],
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
